package com.sansui.Splash; 

import java.io.InputStream;

import android.app.Activity;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;

import com.example.combat_ascytask_obsever.R;
import com.sansui.Application.Config;
import com.sansui.Application.DownObserver;
import com.sansui.Http.HttpHelper;
import com.sansui.cache.BitmapHelper;
import com.sansui.cache.FileCache;
import com.sansui.cache.MemoryCache;

public class SplashActivity extends Activity implements Config {

	
	public final String imgUrl = "http://developer.android.com/images/home/aw_dac.png";
	
	private static Handler mHandler = new Handler(){
		
		@Override
		public void handleMessage(Message msg) {
			super.handleMessage(msg);
		}
		
	};
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.splashview);
		
		HttpHelper helper = new HttpHelper();
		//helper.add(new DBHandler());
		helper.add(new SpalshUIhandler());
		helper.AscyDownLoadIMG(imgUrl, MSGW_SPLASH);
		
	}
	class  SpalshUIhandler implements DownObserver{

		@Override
		public void finish(Object obj, int what) {
			MemoryCache meomoryCache = new MemoryCache();
			FileCache fileCache = new FileCache();
			
			BitmapHelper bitmapHelper = BitmapHelper.getInstance();
			Bitmap b = bitmapHelper.loadStandBitmap((InputStream)obj, 1, 1);
			Log.i(TAG, "Bitmap : " + b);
			meomoryCache.put("bitmap", b);
			boolean is = fileCache.put("TestP.png", b);
			Log.i(TAG, "isFileCacheOK -- " + is);
			Log.i(TAG, "O2222k");
		}
		
	}
}
